import { ElMessage } from "element-plus";

/// 单聊选项
let singleSelectOptions = [
    {
        value: 0,
        paramKey: "phone",
        label: "手机号",
        placeholder: "请输入手机号",
      },
      {
        value: 1,
        paramKey: "userId",
        label: "userId",
        placeholder: "请输入userId",
      },
      {
        value: 2,
        paramKey: "shopId",
        label: "sellerId",
        placeholder: "请输入shopId",
      },
      {
        value: 3,
        paramKey: "uid",
        label: "imUID",
        placeholder: "请输入imUID",
      },
      {
        value: 4,
        paramKey: "userId",
        label: "子账号Id",
        placeholder: "请输入子账号userId",
      },
];

/// 群聊选项
let groupSelectOptions = [
    {
        value: 0,
        paramKey: "phone",
        label: "手机号",
        placeholder: "请输入手机号",
      },
      {
        value: 1,
        paramKey: "userId",
        label: "userId",
        placeholder: "请输入userId",
      },
      {
        value: 2,
        paramKey: "shopId",
        label: "sellerId",
        placeholder: "请输入shopId",
      },
      {
        value: 3,
        paramKey: "uid",
        label: "imUID",
        placeholder: "请输入imUID",
      },
];

/// 用户来源
let fromSourceMap = {
    0: "-",
    1: "微店APP",
    2: "微店页面",
    3: "专享小程序",
    4: "公众号",
    5: "腾讯直播",
    6: "店长端",
    7: "微店",
    8: "私域分销",
    9: "微店卖卖",
    10: "上车团",
};

/// 消息类型
let messageMediaTypes = [
    {value:1, label:"文本消息"},
    {value:8, label:"卡片消息"},
];

let groupTypes = [
    {value:0, label:"普通群"},
    {value:1, label:"商学院群"},
    {value:2, label:"抱团群"},
    {value:3, label:"同盟会群"},
    {value:4, label:"互推群"},
    {value:5, label:"回头客群"},
    {value:6, label:"打卡群"},
    {value:7, label:"直播群"},
    {value:8, label:"代理群"},
    {value:9, label:"顾客群"},
    {value:10, label:"商品群"},
    {value:11, label:"圈子群"},
];  

/// 消息卡片类型
let messageCardTypes = [
    {value:0, label:"商品派送中"},
    {value:1, label:"付款成功"},
    {value:2, label:"商家已发货"},
    {value:3, label:"商品签收"},
    {value:4, label:"商家拒绝退款"},
    {value:5, label:"发起收款消息"},
    {value:6, label:"商家拒绝退货"},
    {value:7, label:"商家同意退货"},
    {value:8, label:"商品退款成功"},
    {value:9, label:"订单价格修改"},
    {value:10, label:"商家主动退款"},
    {value:11, label:"商家取消退款"},
    {value:12, label:"订单待评价"},
    {value:13, label:"订单即将关闭"},
    {value:14, label:"分享卡片消息"},
    {value:15, label:"优惠券过期提醒"},
    {value:16, label:"第三方app打开卡片消息"},
    {value:17, label:"借积分活动消息"},
    {value:18, label:"买家心得"},
    {value:19, label:"会员卡升级通知消息"},
    {value:20, label:"积分拍卖"},
    {value:21, label:"组织分享消息"},
    {value:22, label:"帖子分享消息"},
    {value:23, label:"分享抱团群消息"},
    {value:24, label:"抱团群互推活动卡片消息"},
    {value:25, label:"话题分享卡片消息"},
    {value:26, label:"分享链接"},
    {value:27, label:"分享抱团互推群"},
    {value:28, label:"群专享优惠"},
    {value:29, label:"邀请加入回头客群"},
    {value:30, label:"跨店优惠券"},
    {value:31, label:"刷脸卡"},
    {value:32, label:"分期支付还款）"},
    {value:33, label:"微客多 广告催欠款"},
    {value:34, label:"新人押宝"},
    {value:35, label:"瓜分百万红包"},
    {value:36, label:"省钱券包"},
    {value:37, label:"一元抽奖活动"},
    {value:38, label:"金融小助手现金贷"},
    {value:39, label:"明星打榜开奖消息"},
    {value:40, label:"0元购返现礼包"},
    {value:41, label:"明星个人主页"},
    {value:42, label:"商城粉丝推广"},
    {value:43, label:"新用户首单返券"},
    {value:44, label:"动态浏览"},
    {value:45, label:"伏羲群发后台模版1(标准)"},
    {value:46, label:"伏羲群发后台模版2(含底部文案)"},
    {value:47, label:"伏羲群发后台模版3(大图)"},
    {value:48, label:"伏羲群发后台模版4(红包)"},
    {value:49, label:"伏羲群发后台模版5(优惠券)"},
    {value:50, label:"榜单卡片消息"},
    {value:51, label:"天天领红包"},
    {value:52, label:"支付券"},
    {value:53, label:"视频红包通知消息"},
    {value:54, label:"收货提醒"},
    {value:55, label:"代下单"},
    {value:56, label:"动态发布@消息"},
    {value:58, label:"内容分成-创作者开通通知"},
    {value:59, label:"买家版APP新用户 内容创作引导"},
    {value:60, label:"新店铺 内容创作引导"},
    {value:61, label:"确认收货3天召回评价消息"},
    {value:62, label:"确认收货7天召回评价消息"},
    {value:63, label:"圈子贴举报消息"},
    {value:64, label:"史莱姆卡片消息"},
    {value:65, label:"新建圈子IM通知粉丝消息"},
    {value:66, label:"上车团分享订单卡片"},
    {value:67, label:"新优惠券"},
    {value:68, label:"自动核对订单卡片"},
    {value:69, label:"商家收到修改订单卡片"},
    {value:70, label:"商家点击确认修改按钮"},
    {value:71, label:"二手交易订单类卡片"},
    {value:72, label:"二手交易订单类卡片消息"},
    {value:73, label:"用户反馈官方回复卡片"},
    {value:74, label:"社区内容动态卡片消息"},
    {value:101, label:"店铺专享红包"},
    {value:110, label:"关系链红包老样式"},
    {value:1002, label:"店铺上新"},
    {value:1003, label:"图文视频动态"},
    {value:1004, label:"促销活动"},
    {value:1005, label:"转发口碑"},
    {value:1006, label:"圈子群投票活动"},
    {value:10000, label:"默认卡片消息"},
];

/// 群类型
let groupTypeMap = {
    0:"普通群",
    1:"商学院群",
    2:"抱团群",
    3:"同盟会群",
    4:"互推群",
    5:"回头客群",
    6:"打卡群",
    7:"直播群",
    8:"代理群",
    9:"顾客群",
    10:"商品群",
    11:"圈子群",
};

export default {
    singleSelectOptions, 
    groupSelectOptions,
    messageMediaTypes,
    messageCardTypes,
    groupTypes,
    
    fromSource(type) {
        let key = type || 0;
        return fromSourceMap[key];
    },

    messageTypeWithMsg(msg) {
        if (msg.msgType === "系统消息") {
            return "系统消息";
        } else {
            return msg.msgMediaType;
        }
    },

    groupType(type) {
        let key = type || 0;
        return groupTypeMap[key];
    },

    groupMemberIdentify(identify) {
        switch(identify) {
            case 0 :
                return "普通成员";
            case 1:
                return "群主";
            case 2:
                return "管理员";
            default:
                return "-";
        }
    },

    boolFormatter(val) {
        return val ? "是" : "否";
    },

    stringFormatter(val) {
        return val ? val : "-";
    },

    toast(message) {
        ElMessage({ message: message, type: "error", });
    },

    success(message) {
        ElMessage({ message: message, type: "success", });
    }
}
